<?php
	require_once("../inc/models/orders_model.php");
	if(isset($_POST['submit']))
	{
		$row = $_POST;
		NewOrder($row);
		header("Location: index.php");
	}
	else
	{	
		$customer = GetCustomers();
	}
?>
<!DOCTYPE html>
<html lang="en">
        <?php include('../inc/header.php'); ?>
        <body>
        <?php include('../inc/navigation.php'); ?>
        <div class="span9">
        	<div class="row-fluid">
	        	<h2>Create New Order</h2>        	
	        	<form class="well" method="post" action="#">
					<div class="control-group">
						<label class="control-label" for="customer_id">Customer:</label>
						<div class="controls">
	                        	<select name="customer_id" id = "customer_id">
	                        		<? while($rs = $customer->fetch_assoc()): ?>
	                        			<option value="<?=$rs['id']?>"><?=$rs['FirstName']?> <?=$rs['LastName']?></option>
	                        		<?php endwhile; ?>                        		                    		
	                        	</select>                        	                            	
	                    </div>
					</div>
					<div class="control-group">
						<label class="control-label" for="amount">Amount:</label>
						<div class="controls">
							<input type="text" name="amount" id="amount"/>
						</div>
					</div> 
					<div class="control-group">
						<label class="control-label" for="address">Address:</label>
						<div class="controls">
							<input type="text" name="address" id="address"/>
						</div>
					</div> 
					<div class="control-group">
						<label class="control-label" for="city">City:</label>
						<div class="controls">
							<input type="text" name="city" id="city"/>
						</div>
					</div> 
					<div class="control-group">
						<label class="control-label" for="state">State:</label>
						<div class="controls">
							<input type="text" name="state" id="state"/>
						</div>
					</div> 
					<div class="control-group">
						<label class="control-label" for="zip">Zip Code:</label>
						<div class="controls">
							<input type="text" name="zip" id="zip"/>
						</div>
					</div> 
					<div class="control-group">
						<label class="control-label" for="country">Country:</label>
						<div class="controls">
							<input type="text" name="country" id="country"/>
						</div>
					</div> 
					<div class="control-group">
						<label class="control-label" for="phone">Phone:</label>
						<div class="controls">
							<input type="text" name="phone" id="phone"/>
						</div>
					</div> 
					<div class="control-group">
						<label class="control-label" for="tax">Tax:</label>
						<div class="controls">
							<input type="text" name="tax" id="tax"/>
						</div>
					</div> 
					<div class="control-group">
						<label class="control-label" for="email">Email:</label>
						<div class="controls">
							<input type="text" name="email" id="email"/>
						</div>
					</div> 
					
					<input type="submit" name="submit" value="Submit" />
				</form>
        </div>
     </div>
     <!-- All Bootstrap JavaScript Files -->
       <script src="../inc/bootstrap/js/jquery.js"></script>
       <script src="../inc/bootstrap/js/bootstrap.js"></script>
   </body>
</html>